package com.rainbow.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.rainbow.entity.Menu;
import com.rainbow.expetion.MyException;
import com.rainbow.mapper.MenuMapper;
import com.rainbow.service.MenuService;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Author rainbow
 **/
@Service
@Transactional(rollbackFor = MyException.class)
@CacheConfig(cacheNames = "menus_cache")
public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements MenuService {

    @Override
    public List<Menu> getAllMenu() {
        return baseMapper.getAllMenu();
    }

    @Override
    public List<Menu> getMenusByHrId(Long hrId) {
        return baseMapper.getMenusByHrId(hrId);
    }

    @Override
    public List<Menu> menuTree() {
        return baseMapper.menuTree();
    }

    @Override
    public List<Long> getMenusByRid(Long rid) {
        return baseMapper.getMenusByRid(rid);
    }
}
